import { api } from '../utils/apiWrapper.js'
//#region 设备合同信息表
// 获取设备合同信息表列表
export function getProjectEquipmentManagementList(params) {
  return api.get('/api/data/equipment_contract', params)
  //数据格式如下
 /*  {
    "data": [
      {
        "id": 1,
        "project_id": "示例项目编号 1",
        "equipment_name": "示例设备名称 1",
        "equipment_type": "示例设备类型 1",
        "equipment_sum": 100,
        "supplier": "示例供货商 1",
        "equipment_sumtype": "示例设备单位 1"
      },
      {
        "id": 2,
        "project_id": "示例项目编号 2",
        "equipment_name": "示例设备名称 2",
        "equipment_type": "示例设备类型 2",
        "equipment_sum": 200,
        "supplier": "示例供货商 2",
        "equipment_sumtype": "示例设备单位 2"
      }
    ],
    "total": 100,
    "page": 1,
    "pageSize": 10,
    "totalPages": 10
  } */
}

// 获取设备合同信息表详情
export function getProjectEquipmentManagementById(id) {
  return api.get(`/api/data/equipment_contract/${id}`)
}

//创建设备合同信息表
export function createProjectEquipmentManagement(data)
{
    return api.post('/api/data/equipment_contract', data)
}

//更新设备合同信息表
export function updateProjectEquipmentManagement(id, data)
{
    return api.put(`/api/data/equipment_contract/${id}`, data)
}

//删除设备合同信息表
export function deleteProjectEquipmentManagement(id){
    return api.delete(`/api/data/equipment_contract/${id}`)
}
//#endregion

//#region 设备下单信息管理
// 获取设备下单信息管理列表
export function getProjectEquipmentOrderList(params){
    return api.get('/api/data/equipment_order', params)
    //数据格式如下
    /*
    {
  "data": [
    {
      "id": 1,
      "project_id": "示例项目编号 1",
      "equipment_id": "示例设备名称 1",
      "quantity": "示例下单数量 1",
      "unit_price": 100,
      "total_price": 100,
      "purchaser": "示例采购人 1",
      "Reqd_date": "2025-08-12",
      "remark": "示例备注 1"
    },
    {
      "id": 2,
      "project_id": "示例项目编号 2",
      "equipment_id": "示例设备名称 2",
      "quantity": "示例下单数量 2",
      "unit_price": 200,
      "total_price": 200,
      "purchaser": "示例采购人 2",
      "Reqd_date": "2025-08-12",
      "remark": "示例备注 2"
    }
  ],
  "total": 100,
  "page": 1,
  "pageSize": 10,
  "totalPages": 10
}
    */

}
// 获取设备下单信息管理详情
export function getProjectEquipmentOrderById(id){
    return api.get(`/api/data/equipment_order/${id}`)
}
//创建设备下单信息管理
export function createProjectEquipmentOrder(data){
    return api.post('/api/data/equipment_order', data)
}
//更新设备下单信息管理  
export function updateProjectEquipmentOrder(id, data){
    return api.put(`/api/data/equipment_order/${id}`, data)
}
//删除设备下单信息管理
export function deleteProjectEquipmentOrder(id){
    return api.delete(`/api/data/equipment_order/${id}`)
}
//#endregion

//#region 入库信息表
// 获取入库信息表列表   
export function getProjectEquipmentInboundList(params){
    return api.get('/api/data/stock_in', params)
    //数据格式如下
    /*          
     {
  "data": [
    {
      "id": 1,
      "project_id": "示例项目编号 1",
      "equipment_id": "示例关联设备编号 1",
      "in_date": "2025-08-12",
      "quantity": 100,
      "receiver": "示例入库人 1",
      "remark": "示例备注 1"
    },
    {
      "id": 2,
      "project_id": "示例项目编号 2",
      "equipment_id": "示例关联设备编号 2",
      "in_date": "2025-08-12",
      "quantity": 200,
      "receiver": "示例入库人 2",
      "remark": "示例备注 2"
    }
  ],
  "total": 100,
  "page": 1,
  "pageSize": 10,
  "totalPages": 10
}   
    */
}
// 获取入库信息表详情
export function getProjectEquipmentInboundById(id){
    return api.get(`/api/data/stock_in/${id}`)
}
//创建设备入库信息表
export function createProjectEquipmentInbound(data){
    return api.post('/api/data/stock_in', data)
}
//更新设备入库信息表
export function updateProjectEquipmentInbound(id, data){
    return api.put(`/api/data/stock_in/${id}`, data)
}  
//删除设备入库信息表
export function deleteProjectEquipmentInbound(id){
    return api.delete(`/api/data/stock_in/${id}`)
}

//#endregion

//#region 出库信息表
// 获取出库信息表列表
export function getProjectEquipmentOutboundList(params){
    return api.get('/api/data/stock_out', params)
    //数据格式如下
    /*
    
  "data": [
    {
      "id": 1,
      "project_id": "示例项目编号 1",
      "equipment_id": "示例关联设备编号 1",
      "out_date": "2025-08-12",
      "quantity": 100,
      "shipper": "示例出库人 1",
      "remark": "示例备注 1"
    },
    {
      "id": 2,
      "project_id": "示例项目编号 2",
      "equipment_id": "示例关联设备编号 2",
      "out_date": "2025-08-12",
      "quantity": 200,
      "shipper": "示例出库人 2",
      "remark": "示例备注 2"
    }
  ],
  "total": 100,
  "page": 1,
  "pageSize": 10,
  "totalPages": 10
}   
    */
}
// 获取出库信息表详情
export function getProjectEquipmentOutboundById(id){
    return api.get(`/api/data/stock_out/${id}`)
}
//创建设备出库信息表
export function createProjectEquipmentOutbound(data){
    return api.post('/api/data/stock_out', data)
}
//更新设备出库信息表
export function updateProjectEquipmentOutbound(id, data){
    return api.put(`/api/data/stock_out/${id}`, data)
}
//删除设备出库信息表
export function deleteProjectEquipmentOutbound(id){
    return api.delete(`/api/data/stock_out/${id}`)
}
//#endregion
